# encoding: utf-8


while True:
	try:
		s_num = input('请输入两个自然整数以空格隔开(退出请按Q或q):')
		if s_num.strip().lower() == 'q':
			break	
		m,n = s_num.split(' ')
		m = int(m)
		n = int(n)	
	except:
		print('非常自然整数！请重新输入！')
		continue

	if m == 1 or m == n:
		print('最大公约数:%d,最小公倍数:%d' % (m, m*n//m))
		continue
	
	for i in range(min(m, n), 0, -1):
		if m % i == 0 and n % i == 0:
			print('最大公约数:%d,最小公倍数:%d' % (int(i), m*n//int(i)))
			break
		
	